import React, { Component,PureComponent } from 'react'
import Child from './Child'
import Function from './Function'
export default class Parent extends PureComponent {
    state = {
        age: 20,
        isShow:true
    }
    changeAgeCallback = (age)=>{
        console.log("changeAgeCallback",age)
        this.setState({age})
    }
    unmounted(){
        this.setState({
            isShow:false
        })
    }
    render() {
        return (
            <div>
                {this.state.isShow ? <Function msg='111' age={this.state.age} callback={this.changeAgeCallback}></Function>:<></>}
                <button onClick={()=>this.unmounted()}>卸载组件</button>
            </div>
        )
    }
}
